//
//  SoundDetailHeadView.m
//  NineGroupProject
//
//  Created by dllo on 15/12/28.
//  Copyright © 2015年 lushan. All rights reserved.
//

#import "SoundDetailHeadView.h"
#import "Masonry.h"

@implementation SoundDetailHeadView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews{
    
    self.headImage = [[UIImageView alloc]init];
    [self addSubview:self.headImage];
    [self.headImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(0);
        make.width.mas_equalTo(WIDTH);
        make.height.mas_equalTo(HEIGHT / 3.5);
    }];
    
    self.pic = [[UIImageView alloc]init];
    self.pic.layer.masksToBounds = YES;
    self.pic.layer.cornerRadius = WIDTH / 9 / 2;
    [self addSubview:self.pic];
    [self.pic mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(WIDTH / 14);
        make.top.equalTo(self.headImage.mas_bottom).offset(20 * HEI);
        make.size.mas_equalTo(WIDTH / 9);
    }];
    
    self.titleLabel = [[UILabel alloc]init];
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.pic.mas_right).offset(10 * WID);
        make.top.equalTo(self.pic.mas_top).offset(WIDTH / 36);
        make.height.equalTo(self.pic.mas_height).multipliedBy(0.5);
        make.width.mas_equalTo(WIDTH / 4);
    }];
                                                                            
    self.briefLabel = [[UILabel alloc]init];
    self.briefLabel.font = [UIFont systemFontOfSize:16];
    [self addSubview:self.briefLabel];
    [self.briefLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.pic.mas_left);
        make.bottom.mas_equalTo(0);
        make.width.mas_equalTo(WIDTH);
        make.height.equalTo(self.titleLabel.mas_height);
    }];
    
    self.playImage = [[UIImageView alloc]init];
    self.playImage.image = [UIImage imageNamed:@"iconfont-31shengbo.png"];
    [self addSubview:self.playImage];
    [self.playImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(WIDTH * 0.7);
        make.top.equalTo(self.titleLabel.mas_top);
        make.size.equalTo(self.pic).multipliedBy(0.3);
    }];
    
    self.countLabel = [[UILabel alloc]init];
    self.countLabel.font = [UIFont systemFontOfSize:10];
    [self addSubview:self.countLabel];
    [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.playImage.mas_right).offset(2.5 * WID);
        make.top.equalTo(self.playImage.mas_top);
        make.right.mas_equalTo(-5 * WID);
        make.height.equalTo(self.playImage.mas_height);
    }];
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
